Bill Fisher: This patch fixes an ill-formed comparison when parsing control escapes, e.g. "\cA\ca". The code will now throw an error_escape exception for invalid control sequences like "\c:" or "\c". I've added the test cases to bad_escape.pass.cpp. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186335 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/regex b/include/regex index 19e08b1..3ec2ff9 100644 --- a/include/regex +++ b/include/regex 
@@ -4418,7 +4418,8 @@  case 'c':  if ((__t = _VSTD::next(__first)) != __last)  { - if ('A' <= *__t <= 'Z' || 'a' <= *__t <= 'z') + if (('A' <= *__t && *__t <= 'Z') ||  + ('a' <= *__t && *__t <= 'z'))  {  if (__str)  *__str = _CharT(*__t % 32); @@ -4426,7 +4427,15 @@  __push_char(_CharT(*__t % 32));  __first = ++__t;  } +#ifndef _LIBCPP_NO_EXCEPTIONS + else  + throw regex_error(regex_constants::error_escape); +#endif // _LIBCPP_NO_EXCEPTIONS  } +#ifndef _LIBCPP_NO_EXCEPTIONS + else + throw regex_error(regex_constants::error_escape); +#endif // _LIBCPP_NO_EXCEPTIONS  break;  case 'u':  ++__first;